package Array;

import org.junit.Test;

/**
 * @BelongsProject: SeniorArchitect-LeetCode
 * @BelongsPackage: Array
 * @Author: zhuangxiaoyan
 * @CreateTime: 2023-11-26  11:18
 * @Description: TODO
 * @Version: 1.0
 */
public class 美丽的数字 {

    public int beautifulSubstrings(String s, int k) {
        String y = "aeiou";
        int n = s.length();
        int ans = 0;
        for (int i = 0; i < n; i++) {
            int vowels = 0, consonants = 0;
            for (int j = i; j < n; j++) {
                if (y.indexOf(s.charAt(j)) != -1) {
                    vowels += 1;
                } else {
                    consonants += 1;
                }
                if (vowels == consonants && (vowels * consonants) % k == 0) {
                    ans += 1;
                }
            }
        }
        return ans;
    }
}
